<?php 
class Employee extends ci_controller {




function display_employees($sort_by = 'title', $sort_order = 'asc', $offset = 0) {
		
							$limit = 20;
							$data['fields'] = array(
								'title' => 'title',
								'firstName' => 'firstName',
								'lastName' => 'lastName',
								'city' => 'city',
								'position' => 'position'
								
							);
							 
							$this->load->model('employee_model');
							
							$results = $this->employee_model->list_employees($limit, $offset, $sort_by, $sort_order);
							
							$data['employee'] = $results['rows'];
							$data['num_results'] = $results['num_rows'];
							
							// pagination
							$this->load->library('pagination');
							$config = array();
							$config['base_url'] = site_url("employee/display/$sort_by/$sort_order");
							$config['total_rows'] = $data['num_results'];
							$config['per_page'] = $limit;
							$config['uri_segment'] = 5;
							$this->pagination->initialize($config);
							$data['pagination'] = $this->pagination->create_links();
							
							$data['sort_by'] = $sort_by;
							$data['sort_order'] = $sort_order;
					
							 $data1['main_content']='view_staff';
							 $this->load->view('includes/template',$data1);
							
	}






















function add_employee()
{
	$data=array();
				$this->load->model('employee_model');
				if ($q=$this->employee_model->add_employee()) 
				{$data['employee']=$q;}
	
	  $data['main_content']='view_staff';
	  $this->load->view('includes/template',$data);
					
	
	
	
	}	
}
?>